package com.example.demo.controller;

import com.example.demo.obj.User;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/**
 *原生swagger界面网址：http://localhost:8080/swagger-ui/index.html
 *如果加入了上面的第三方依赖，请访问这个地址：http://localhost:8080/doc.html
 * @author lanhai
 */
@Api(tags = "用户信息增删改查类")
@RestController
public class UserController {

        @ApiOperation(value = "查询用户信息", notes = "根据姓名查询用户，可以增加年龄进行过滤")
        @ApiImplicitParams({
                @ApiImplicitParam(name = "name", value = "姓名", required = true),
                @ApiImplicitParam(name = "age",  value = "年龄", required = false,defaultValue = "")
        })
        @PostMapping("selectUser")
        public List<User> selectUser(String name, Integer age){
            return new ArrayList<>();
        }

        @ApiOperation(value = "添加一个用户")
        @PostMapping("addUser")
        public void addUser(User user){

        }
}
